package com.zhzt.helloserver.service.impl;

import com.google.protobuf.StringValue;
import com.zhzt.grpc.hello.service.HelloServiceGrpc;
import io.grpc.stub.StreamObserver;
import net.devh.boot.grpc.server.service.GrpcService;

@GrpcService
public class HelloServiceImpl extends HelloServiceGrpc.HelloServiceImplBase {

    @Override
    public void sayHello(StringValue request, StreamObserver<StringValue> responseObserver) {
        String value = request.getValue();

        //返回回去
        responseObserver.onNext(StringValue.newBuilder().setValue("hello  "+value).build());
        //编译
        responseObserver.onCompleted();
        System.out.println("====================");
    }
}
